<?php
session_start();
require_once('./dbconnect.class.php');    //导入class文件
require_once('./db_config.php');
header('Content-Type:text/html;charset=utf-8');

$dbconnect = new dbconnect($localhost,$username,$password,$dbname);
$sql = 'select count(*) from follow';
$count = $dbconnect->executeQuery($sql);
$allpage = ceil($count[0][0]/50);
$page = $_REQUEST['page']?$_REQUEST['page']-1:0;
$data = $dbconnect->selectAll('follow' ,($page*50).',50');
// foreach ($data as $key => $value) {
// 	if ($key>0) {
// 	// var_dump($value);die;
// 		# code...
// 		echo "<a href='https://space.bilibili.com/".$value['fid']."'><img wdith='40px' height='40px' src='".$value['face']."'>".$value['uname']."</a>";
// 	}
// }
?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
	<link href="//cdn.bootcss.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="row">
	<div class="col-sm-3">序号</div>
	<div class="col-sm-3">头像</div>
	<div class="col-sm-3">昵称</div>
	<div class="col-sm-3">fid</div>
	<!-- <div class="col-sm-3">record_id</div> -->
	<br>
	<br>
	<?php foreach ($data as $key => $value) { 
		if ($key>0) {
			echo '<div class="col-sm-3">'.($key-1).'</div>';
			echo '<div class="col-sm-3"><img wdith="40px" height="40px" src="'.$value['face'].'"></div>';
			echo '<div class="col-sm-3"><a target="_blank" href="https://space.bilibili.com/'.$value['fid'].'">'.$value['uname'].'</a></div>';
			echo '<div class="col-sm-3">'.$value['fid'].'</div>';
			// echo '<div class="col-sm-3">'.$value['record_id'].'</div>';
		}
	}?>
</div>
<div style="width: 100%;text-align:center">
	<form action="?" method="get">
		<a href="?page=0"><<</a>
		<a href="?page=<?=$page-1?>"><?=$page-1?></a>
		<a href="?page=<?=$page?>"><?=$page?></a>
		<?=$page+1?>
		<a href="?page=<?=$page+2?>"><?=$page+2?></a>
		<a href="?page=<?=$page+3?>"><?=$page+3?></a>
		<a href="?page=<?=$allpage-2?>">>></a>
	  	<input type="text" name="page" />
	  	<input type="submit" value="Submit" />
	</form>
</div>
</body>
</html>
<script src="//cdn.bootcss.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>